.class public final Lcom/burstly/lib/util/ManifestValidator;
.super Ljava/lang/Object;
.source "ManifestValidator.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/burstly/lib/util/ManifestValidator$ValidationResults;
    }
.end annotation


# static fields
.field private static final BURSTLY_XML_SCHEME:Ljava/lang/String; = "http://www.burstly.com/scheme"

.field private static final LOG:Lcom/burstly/lib/util/LoggerExt;

.field private static final TAG:Ljava/lang/String;

.field private static sIsValidated:Z

.field private static sResults:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List",
            "<",
            "Lcom/burstly/lib/util/ManifestValidator$ValidationResults;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 161
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/util/ManifestValidator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    .line 166
    const-class v0, Lcom/burstly/lib/util/ManifestValidator;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/util/ManifestValidator;->TAG:Ljava/lang/String;

    return-void
.end method

.method private constructor <init>()V
    .locals 0

    .prologue
    .line 182
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 183
    return-void
.end method

.method private static checkActivities(Landroid/content/pm/PackageInfo;Ljava/util/List;)Ljava/util/List;
    .locals 1
    .parameter "packageInfo"
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/pm/PackageInfo;",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;)",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 342
    .local p1, requiredActivities:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    iget-object v0, p0, Landroid/content/pm/PackageInfo;->activities:[Landroid/content/pm/ActivityInfo;

    if-eqz v0, :cond_0

    if-eqz p1, :cond_0

    .line 343
    iget-object v0, p0, Landroid/content/pm/PackageInfo;->activities:[Landroid/content/pm/ActivityInfo;

    invoke-static {v0}, Lcom/burstly/lib/util/ManifestValidator;->selectActivityNames([Landroid/content/pm/ActivityInfo;)Ljava/util/List;

    move-result-object v0

    invoke-static {p1, v0}, Lcom/burstly/lib/util/ManifestValidator;->validate(Ljava/util/List;Ljava/util/List;)Ljava/util/List;

    move-result-object p1

    .line 345
    .end local p1           #requiredActivities:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    :cond_0
    return-object p1
.end method

.method private static checkPermissions(Landroid/content/pm/PackageInfo;Ljava/util/List;)Ljava/util/List;
    .locals 1
    .parameter "packageInfo"
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/pm/PackageInfo;",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;)",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 356
    .local p1, requiredPermissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    iget-object v0, p0, Landroid/content/pm/PackageInfo;->requestedPermissions:[Ljava/lang/String;

    if-eqz v0, :cond_0

    if-eqz p1, :cond_0

    .line 357
    iget-object v0, p0, Landroid/content/pm/PackageInfo;->requestedPermissions:[Ljava/lang/String;

    invoke-static {v0}, Ljava/util/Arrays;->asList([Ljava/lang/Object;)Ljava/util/List;

    move-result-object v0

    invoke-static {p1, v0}, Lcom/burstly/lib/util/ManifestValidator;->validate(Ljava/util/List;Ljava/util/List;)Ljava/util/List;

    move-result-object p1

    .line 359
    .end local p1           #requiredPermissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    :cond_0
    return-object p1
.end method

.method public static customValidate(Landroid/content/Context;Ljava/util/List;Ljava/util/List;Ljava/util/List;)Lcom/burstly/lib/util/ManifestValidator$ValidationResults;
    .locals 7
    .parameter "context"
    .parameter
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/Context;",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;)",
            "Lcom/burstly/lib/util/ManifestValidator$ValidationResults;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/content/pm/PackageManager$NameNotFoundException;
        }
    .end annotation

    .prologue
    .line 306
    .local p1, mandatoryActivities:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    .local p2, mandatoryPermissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    .local p3, optionalPermissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    invoke-virtual {p0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v0

    .line 307
    .local v0, appPackageName:Ljava/lang/String;
    invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;

    move-result-object v3

    const/16 v4, 0x1001

    invoke-virtual {v3, v0, v4}, Landroid/content/pm/PackageManager;->getPackageInfo(Ljava/lang/String;I)Landroid/content/pm/PackageInfo;

    move-result-object v1

    .line 309
    .local v1, packageInfo:Landroid/content/pm/PackageInfo;
    new-instance v2, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;

    invoke-direct {v2, p1, p2, p3}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;-><init>(Ljava/util/List;Ljava/util/List;Ljava/util/List;)V

    .line 311
    .local v2, results:Lcom/burstly/lib/util/ManifestValidator$ValidationResults;
    if-eqz v1, :cond_0

    .line 312
    invoke-static {v1, p1}, Lcom/burstly/lib/util/ManifestValidator;->checkActivities(Landroid/content/pm/PackageInfo;Ljava/util/List;)Ljava/util/List;

    move-result-object v3

    invoke-virtual {v2, v3}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;->setMandatoryActivities(Ljava/util/List;)V

    .line 313
    invoke-static {v1, p2}, Lcom/burstly/lib/util/ManifestValidator;->checkPermissions(Landroid/content/pm/PackageInfo;Ljava/util/List;)Ljava/util/List;

    move-result-object v3

    invoke-virtual {v2, v3}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;->setMandatoryPermissions(Ljava/util/List;)V

    .line 314
    invoke-static {v1, p3}, Lcom/burstly/lib/util/ManifestValidator;->checkPermissions(Landroid/content/pm/PackageInfo;Ljava/util/List;)Ljava/util/List;

    move-result-object v3

    invoke-virtual {v2, v3}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;->setOptionalPermissions(Ljava/util/List;)V

    .line 318
    :goto_0
    return-object v2

    .line 316
    :cond_0
    sget-object v3, Lcom/burstly/lib/util/ManifestValidator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v4, Lcom/burstly/lib/util/ManifestValidator;->TAG:Ljava/lang/String;

    const-string v5, "Could not read package info. Package info is null."

    const/4 v6, 0x0

    new-array v6, v6, [Ljava/lang/Object;

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logWarning(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0
.end method

.method public static customValidate(Ljava/util/List;Ljava/util/List;Ljava/util/List;)Lcom/burstly/lib/util/ManifestValidator$ValidationResults;
    .locals 1
    .parameter
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;)",
            "Lcom/burstly/lib/util/ManifestValidator$ValidationResults;"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/content/pm/PackageManager$NameNotFoundException;
        }
    .end annotation

    .prologue
    .line 330
    .local p0, requiredActivities:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    .local p1, requiredPermissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    .local p2, optionalPermissions:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    invoke-static {}, Lcom/burstly/lib/util/Utils;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    invoke-static {v0, p0, p1, p2}, Lcom/burstly/lib/util/ManifestValidator;->customValidate(Landroid/content/Context;Ljava/util/List;Ljava/util/List;Ljava/util/List;)Lcom/burstly/lib/util/ManifestValidator$ValidationResults;

    move-result-object v0

    return-object v0
.end method

.method public static declared-synchronized getFactory(Ljava/lang/String;)Lcom/burstly/lib/feature/networks/IAdaptorFactory;
    .locals 7
    .parameter "networkName"

    .prologue
    .line 290
    const-class v2, Lcom/burstly/lib/util/ManifestValidator;

    monitor-enter v2

    :try_start_0
    invoke-static {p0}, Lcom/burstly/lib/feature/FeatureFactory;->getAdaptorFactoryFeature(Ljava/lang/String;)Lcom/burstly/lib/feature/networks/IAdaptorFactory;

    move-result-object v0

    .line 291
    .local v0, factory:Lcom/burstly/lib/feature/networks/IAdaptorFactory;
    if-nez v0, :cond_0

    .line 292
    sget-object v1, Lcom/burstly/lib/util/ManifestValidator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v3, Lcom/burstly/lib/util/ManifestValidator;->TAG:Ljava/lang/String;

    const-string v4, "No {0} factory in config.xml. Check the configuration file."

    const/4 v5, 0x1

    new-array v5, v5, [Ljava/lang/Object;

    const/4 v6, 0x0

    aput-object p0, v5, v6

    invoke-virtual {v1, v3, v4, v5}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 294
    :cond_0
    monitor-exit v2

    return-object v0

    .line 290
    .end local v0           #factory:Lcom/burstly/lib/feature/networks/IAdaptorFactory;
    :catchall_0
    move-exception v1

    monitor-exit v2

    throw v1
.end method

.method private static init(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 242
    invoke-static {p0}, Lcom/burstly/lib/util/Utils;->setApplicationContext(Landroid/content/Context;)V

    .line 243
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    sput-object v0, Lcom/burstly/lib/util/ManifestValidator;->sResults:Ljava/util/List;

    .line 244
    return-void
.end method

.method private static isMisconfigured(Lcom/burstly/lib/util/ManifestValidator$ValidationResults;)Z
    .locals 3
    .parameter "results"

    .prologue
    const/4 v1, 0x1

    .line 228
    invoke-virtual {p0}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;->getMandatoryActivities()Ljava/util/List;

    move-result-object v0

    .line 229
    .local v0, values:Ljava/util/List;,"Ljava/util/List<*>;"
    if-eqz v0, :cond_1

    invoke-interface {v0}, Ljava/util/List;->isEmpty()Z

    move-result v2

    if-nez v2, :cond_1

    .line 233
    :cond_0
    :goto_0
    return v1

    .line 232
    :cond_1
    invoke-virtual {p0}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;->getMandatoryPermissions()Ljava/util/List;

    move-result-object v0

    .line 233
    if-eqz v0, :cond_2

    invoke-interface {v0}, Ljava/util/List;->isEmpty()Z

    move-result v2

    if-eqz v2, :cond_0

    :cond_2
    const/4 v1, 0x0

    goto :goto_0
.end method

.method public static logAllValidationFailures(Lcom/burstly/lib/util/ManifestValidator$ValidationResults;Ljava/lang/String;)Ljava/lang/String;
    .locals 6
    .parameter "results"
    .parameter "network"

    .prologue
    const/4 v5, 0x1

    const/4 v4, 0x0

    .line 402
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    .line 403
    .local v0, message:Ljava/lang/StringBuilder;
    invoke-virtual {p0}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;->getMandatoryActivities()Ljava/util/List;

    move-result-object v1

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, " activity"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2, v5}, Lcom/burstly/lib/util/ManifestValidator;->logValidationFailures(Ljava/util/List;Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 404
    invoke-virtual {p0}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;->getMandatoryPermissions()Ljava/util/List;

    move-result-object v1

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, " permission"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2, v5}, Lcom/burstly/lib/util/ManifestValidator;->logValidationFailures(Ljava/util/List;Ljava/lang/String;Z)Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 405
    invoke-virtual {p0}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;->getOptionalPermissions()Ljava/util/List;

    move-result-object v1

    new-instance v2, Ljava/lang/StringBuilder;

    invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, " permission"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v1, v2, v4}, Lcom/burstly/lib/util/ManifestValidator;->logValidationFailures(Ljava/util/List;Ljava/lang/String;Z)Ljava/lang/String;

    .line 406
    invoke-virtual {v0}, Ljava/lang/StringBuilder;->length()I

    move-result v1

    if-lez v1, :cond_0

    .line 407
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "A list of critical manifest errors for "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string v2, ":\n"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v4, v1}, Ljava/lang/StringBuilder;->insert(ILjava/lang/String;)Ljava/lang/StringBuilder;

    .line 408
    const-string v1, "\n\n"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 410
    :cond_0
    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    return-object v1
.end method

.method private static logValidationFailures(Ljava/util/List;Ljava/lang/String;Z)Ljava/lang/String;
    .locals 10
    .parameter
    .parameter "itemName"
    .parameter "isCritical"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;",
            "Ljava/lang/String;",
            "Z)",
            "Ljava/lang/String;"
        }
    .end annotation

    .prologue
    .local p0, failed:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    const/4 v9, 0x2

    const/4 v8, 0x1

    const/4 v7, 0x0

    .line 422
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    .line 423
    .local v1, logLine:Ljava/lang/StringBuilder;
    if-eqz p0, :cond_1

    .line 424
    invoke-interface {p0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    .local v0, i$:Ljava/util/Iterator;
    :goto_0
    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-eqz v3, :cond_1

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/String;

    .line 425
    .local v2, permission:Ljava/lang/String;
    if-eqz p2, :cond_0

    .line 426
    sget-object v3, Lcom/burstly/lib/util/ManifestValidator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v4, Lcom/burstly/lib/util/ManifestValidator;->TAG:Ljava/lang/String;

    const-string v5, "Mandatory {0} is missing in AndroidManifest.xml: {1}"

    new-array v6, v9, [Ljava/lang/Object;

    aput-object p1, v6, v7

    aput-object v2, v6, v8

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    .line 428
    const-string v3, "\n"

    invoke-virtual {v1, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    goto :goto_0

    .line 430
    :cond_0
    sget-object v3, Lcom/burstly/lib/util/ManifestValidator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v4, Lcom/burstly/lib/util/ManifestValidator;->TAG:Ljava/lang/String;

    const-string v5, "Optional {0} is missing in AndroidManifest.xml: {1}"

    new-array v6, v9, [Ljava/lang/Object;

    aput-object p1, v6, v7

    aput-object v2, v6, v8

    invoke-virtual {v3, v4, v5, v6}, Lcom/burstly/lib/util/LoggerExt;->logInfo(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_0

    .line 435
    .end local v0           #i$:Ljava/util/Iterator;
    .end local v2           #permission:Ljava/lang/String;
    :cond_1
    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    return-object v3
.end method

.method private static parseConfig(Landroid/content/Context;)Ljava/util/List;
    .locals 13
    .parameter "context"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/Context;",
            ")",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    const/4 v11, 0x1

    const/4 v12, 0x0

    .line 253
    new-instance v4, Ljava/util/ArrayList;

    invoke-direct {v4}, Ljava/util/ArrayList;-><init>()V

    .line 255
    .local v4, features:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    :try_start_0
    invoke-static {}, Lorg/xmlpull/v1/XmlPullParserFactory;->newInstance()Lorg/xmlpull/v1/XmlPullParserFactory;

    move-result-object v3

    .line 256
    .local v3, factory:Lorg/xmlpull/v1/XmlPullParserFactory;
    const/4 v7, 0x1

    invoke-virtual {v3, v7}, Lorg/xmlpull/v1/XmlPullParserFactory;->setNamespaceAware(Z)V

    .line 257
    const/4 v7, 0x0

    invoke-virtual {v3, v7}, Lorg/xmlpull/v1/XmlPullParserFactory;->setValidating(Z)V

    .line 258
    invoke-virtual {v3}, Lorg/xmlpull/v1/XmlPullParserFactory;->newPullParser()Lorg/xmlpull/v1/XmlPullParser;

    move-result-object v0

    .line 259
    .local v0, configXPP:Lorg/xmlpull/v1/XmlPullParser;
    invoke-virtual {p0}, Landroid/content/Context;->getAssets()Landroid/content/res/AssetManager;

    move-result-object v7

    const-string v8, "config.xml"

    invoke-virtual {v7, v8}, Landroid/content/res/AssetManager;->open(Ljava/lang/String;)Ljava/io/InputStream;

    move-result-object v1

    .line 260
    .local v1, configXml:Ljava/io/InputStream;
    const-string v7, "utf-8"

    invoke-interface {v0, v1, v7}, Lorg/xmlpull/v1/XmlPullParser;->setInput(Ljava/io/InputStream;Ljava/lang/String;)V

    .line 261
    :goto_0
    invoke-interface {v0}, Lorg/xmlpull/v1/XmlPullParser;->getEventType()I

    move-result v7

    if-eq v7, v11, :cond_1

    .line 262
    invoke-interface {v0}, Lorg/xmlpull/v1/XmlPullParser;->getEventType()I

    move-result v7

    const/4 v8, 0x2

    if-ne v7, v8, :cond_0

    invoke-interface {v0}, Lorg/xmlpull/v1/XmlPullParser;->getName()Ljava/lang/String;

    move-result-object v7

    const-string v8, "bean"

    invoke-virtual {v7, v8}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v7

    if-eqz v7, :cond_0

    .line 263
    const/4 v7, 0x0

    invoke-interface {v0, v7}, Lorg/xmlpull/v1/XmlPullParser;->getAttributeValue(I)Ljava/lang/String;

    move-result-object v6

    .line 264
    .local v6, networkName:Ljava/lang/String;
    const-string v7, "http://www.burstly.com/scheme"

    const-string v8, "validate"

    invoke-interface {v0, v7, v8}, Lorg/xmlpull/v1/XmlPullParser;->getAttributeValue(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v5

    .line 265
    .local v5, isValidateManifest:Ljava/lang/String;
    invoke-static {v5}, Ljava/lang/Boolean;->parseBoolean(Ljava/lang/String;)Z

    move-result v7

    if-eqz v7, :cond_0

    .line 266
    invoke-interface {v4, v6}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 269
    .end local v5           #isValidateManifest:Ljava/lang/String;
    .end local v6           #networkName:Ljava/lang/String;
    :cond_0
    invoke-interface {v0}, Lorg/xmlpull/v1/XmlPullParser;->next()I
    :try_end_0
    .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1

    goto :goto_0

    .line 272
    .end local v0           #configXPP:Lorg/xmlpull/v1/XmlPullParser;
    .end local v1           #configXml:Ljava/io/InputStream;
    .end local v3           #factory:Lorg/xmlpull/v1/XmlPullParserFactory;
    :catch_0
    move-exception v2

    .line 273
    .local v2, e:Lorg/xmlpull/v1/XmlPullParserException;
    sget-object v7, Lcom/burstly/lib/util/ManifestValidator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v8, Lcom/burstly/lib/util/ManifestValidator;->TAG:Ljava/lang/String;

    const-string v9, "Parse error config.xml. Check the file integrity."

    new-array v10, v12, [Ljava/lang/Object;

    invoke-virtual {v7, v8, v9, v10}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 274
    sget-object v7, Lcom/burstly/lib/util/ManifestValidator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v8, Lcom/burstly/lib/util/ManifestValidator;->TAG:Ljava/lang/String;

    const-string v9, "Detalis: {0}"

    new-array v10, v11, [Ljava/lang/Object;

    invoke-virtual {v2}, Lorg/xmlpull/v1/XmlPullParserException;->getMessage()Ljava/lang/String;

    move-result-object v11

    aput-object v11, v10, v12

    invoke-virtual {v7, v8, v9, v10}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 279
    .end local v2           #e:Lorg/xmlpull/v1/XmlPullParserException;
    :cond_1
    :goto_1
    return-object v4

    .line 276
    :catch_1
    move-exception v2

    .line 277
    .local v2, e:Ljava/io/IOException;
    sget-object v7, Lcom/burstly/lib/util/ManifestValidator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v8, Lcom/burstly/lib/util/ManifestValidator;->TAG:Ljava/lang/String;

    const-string v9, "Can not open config.xml file."

    new-array v10, v12, [Ljava/lang/Object;

    invoke-virtual {v7, v8, v9, v10}, Lcom/burstly/lib/util/LoggerExt;->logError(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    goto :goto_1
.end method

.method private static selectActivityNames([Landroid/content/pm/ActivityInfo;)Ljava/util/List;
    .locals 6
    .parameter "activities"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "([",
            "Landroid/content/pm/ActivityInfo;",
            ")",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 386
    new-instance v1, Ljava/util/ArrayList;

    array-length v5, p0

    invoke-direct {v1, v5}, Ljava/util/ArrayList;-><init>(I)V

    .line 387
    .local v1, activityNames:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    move-object v2, p0

    .local v2, arr$:[Landroid/content/pm/ActivityInfo;
    array-length v4, v2

    .local v4, len$:I
    const/4 v3, 0x0

    .local v3, i$:I
    :goto_0
    if-ge v3, v4, :cond_0

    aget-object v0, v2, v3

    .line 388
    .local v0, activityInfo:Landroid/content/pm/ActivityInfo;
    iget-object v5, v0, Landroid/content/pm/ActivityInfo;->name:Ljava/lang/String;

    invoke-interface {v1, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 387
    add-int/lit8 v3, v3, 0x1

    goto :goto_0

    .line 390
    .end local v0           #activityInfo:Landroid/content/pm/ActivityInfo;
    :cond_0
    return-object v1
.end method

.method private static validate(Ljava/util/List;Ljava/util/List;)Ljava/util/List;
    .locals 4
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;)",
            "Ljava/util/List",
            "<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation

    .prologue
    .line 370
    .local p0, nessecary:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    .local p1, existent:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    new-instance v0, Ljava/util/ArrayList;

    invoke-interface {p0}, Ljava/util/List;->size()I

    move-result v3

    invoke-direct {v0, v3}, Ljava/util/ArrayList;-><init>(I)V

    .line 371
    .local v0, failed:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    invoke-interface {p0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v1

    .local v1, i$:Ljava/util/Iterator;
    :cond_0
    :goto_0
    invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-eqz v3, :cond_1

    invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Ljava/lang/String;

    .line 372
    .local v2, item:Ljava/lang/String;
    invoke-interface {p1, v2}, Ljava/util/List;->contains(Ljava/lang/Object;)Z

    move-result v3

    if-nez v3, :cond_0

    .line 373
    invoke-interface {v0, v2}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    goto :goto_0

    .line 376
    .end local v2           #item:Ljava/lang/String;
    :cond_1
    return-object v0
.end method

.method public static validate(Landroid/content/Context;)V
    .locals 12
    .parameter "context"

    .prologue
    const/4 v9, 0x1

    .line 192
    sget-boolean v10, Lcom/burstly/lib/util/ManifestValidator;->sIsValidated:Z

    if-nez v10, :cond_4

    .line 194
    const/4 v6, 0x0

    .line 195
    .local v6, hasError:Z
    :try_start_0
    invoke-static {p0}, Lcom/burstly/lib/util/ManifestValidator;->init(Landroid/content/Context;)V

    .line 196
    invoke-static {p0}, Lcom/burstly/lib/util/ManifestValidator;->parseConfig(Landroid/content/Context;)Ljava/util/List;

    move-result-object v5

    .line 197
    .local v5, featuresNames:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    invoke-interface {v5}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v7

    .local v7, i$:Ljava/util/Iterator;
    :cond_0
    :goto_0
    invoke-interface {v7}, Ljava/util/Iterator;->hasNext()Z

    move-result v10

    if-eqz v10, :cond_3

    invoke-interface {v7}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Ljava/lang/String;

    .line 198
    .local v3, featureName:Ljava/lang/String;
    invoke-static {v3}, Lcom/burstly/lib/util/ManifestValidator;->getFactory(Ljava/lang/String;)Lcom/burstly/lib/feature/networks/IAdaptorFactory;

    move-result-object v2

    check-cast v2, Lcom/burstly/lib/component/networkcomponent/AbstractAdaptorFactory;

    .line 199
    .local v2, factory:Lcom/burstly/lib/component/networkcomponent/AbstractAdaptorFactory;
    if-eqz v2, :cond_0

    .line 200
    invoke-virtual {v2}, Lcom/burstly/lib/component/networkcomponent/AbstractAdaptorFactory;->validateManifest()Lcom/burstly/lib/util/ManifestValidator$ValidationResults;

    move-result-object v8

    .line 201
    .local v8, tempResults:Lcom/burstly/lib/util/ManifestValidator$ValidationResults;
    sget-object v10, Lcom/burstly/lib/util/ManifestValidator;->sResults:Ljava/util/List;

    invoke-interface {v10, v8}, Ljava/util/List;->add(Ljava/lang/Object;)Z

    .line 202
    if-nez v6, :cond_1

    invoke-static {v8}, Lcom/burstly/lib/util/ManifestValidator;->isMisconfigured(Lcom/burstly/lib/util/ManifestValidator$ValidationResults;)Z

    move-result v10

    if-eqz v10, :cond_2

    :cond_1
    move v6, v9

    :goto_1
    goto :goto_0

    :cond_2
    const/4 v6, 0x0

    goto :goto_1

    .line 205
    .end local v2           #factory:Lcom/burstly/lib/component/networkcomponent/AbstractAdaptorFactory;
    .end local v3           #featureName:Ljava/lang/String;
    .end local v8           #tempResults:Lcom/burstly/lib/util/ManifestValidator$ValidationResults;
    :cond_3
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    .line 206
    .local v0, criticalErrors:Ljava/lang/StringBuilder;
    sget-object v9, Lcom/burstly/lib/util/ManifestValidator;->sResults:Ljava/util/List;

    invoke-interface {v9}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v7

    :goto_2
    invoke-interface {v7}, Ljava/util/Iterator;->hasNext()Z

    move-result v9

    if-eqz v9, :cond_5

    invoke-interface {v7}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v4

    check-cast v4, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;

    .line 207
    .local v4, featureResults:Lcom/burstly/lib/util/ManifestValidator$ValidationResults;
    invoke-virtual {v4}, Lcom/burstly/lib/util/ManifestValidator$ValidationResults;->getNetworkName()Ljava/lang/String;

    move-result-object v9

    invoke-static {v4, v9}, Lcom/burstly/lib/util/ManifestValidator;->logAllValidationFailures(Lcom/burstly/lib/util/ManifestValidator$ValidationResults;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v9

    invoke-virtual {v0, v9}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    :try_end_0
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_2

    .line 215
    .end local v0           #criticalErrors:Ljava/lang/StringBuilder;
    .end local v4           #featureResults:Lcom/burstly/lib/util/ManifestValidator$ValidationResults;
    .end local v5           #featuresNames:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    .end local v7           #i$:Ljava/util/Iterator;
    :catch_0
    move-exception v1

    .line 216
    .local v1, e:Landroid/content/pm/PackageManager$NameNotFoundException;
    sget-object v9, Lcom/burstly/lib/util/ManifestValidator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    sget-object v10, Lcom/burstly/lib/util/ManifestValidator;->TAG:Ljava/lang/String;

    invoke-virtual {v9, v10, v1}, Lcom/burstly/lib/util/LoggerExt;->logThrowable(Ljava/lang/String;Ljava/lang/Throwable;)V

    .line 219
    .end local v1           #e:Landroid/content/pm/PackageManager$NameNotFoundException;
    .end local v6           #hasError:Z
    :cond_4
    :goto_3
    return-void

    .line 209
    .restart local v0       #criticalErrors:Ljava/lang/StringBuilder;
    .restart local v5       #featuresNames:Ljava/util/List;,"Ljava/util/List<Ljava/lang/String;>;"
    .restart local v6       #hasError:Z
    .restart local v7       #i$:Ljava/util/Iterator;
    :cond_5
    if-eqz v6, :cond_6

    .line 210
    :try_start_1
    new-instance v9, Ljava/lang/IllegalStateException;

    new-instance v10, Ljava/lang/StringBuilder;

    invoke-direct {v10}, Ljava/lang/StringBuilder;-><init>()V

    const-string v11, "Mandatory activities or permissions not met!\n"

    invoke-virtual {v10, v11}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v10

    invoke-virtual {v10, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    move-result-object v10

    invoke-virtual {v10}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v10

    invoke-direct {v9, v10}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v9

    .line 212
    :cond_6
    const/4 v9, 0x0

    sput-object v9, Lcom/burstly/lib/util/ManifestValidator;->sResults:Ljava/util/List;

    .line 213
    const/4 v9, 0x1

    sput-boolean v9, Lcom/burstly/lib/util/ManifestValidator;->sIsValidated:Z
    :try_end_1
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_3
.end method
